%load_ext pretty_jupyter

Introduction

In this notebook, we will look at the possibility to export PDF. Generally, there are two ways. Either export to HTML and then get PDF via browser, or via latex (directly).

If we want to use latex method, we need to avoid using HTML. Instead, we need to use Markdown. So for example we shouldn't output pandas table to html in jinja markdown, but rather to markdown. Similar holds for matplotlib figures etc.

Note: Currently Markdown images are not working in Latex PDF export. If we want to display figure, use standard show function in a code cell.

Pandas

import pandas as pd

data = pd.DataFrame({"a": [1, 2, 3, 4], "b": [4, 5, 6, 7]})
a b
1 4
2 5
3 6
4 7

Plot

import matplotlib.pyplot as plt
import seaborn as sns

sns.set_theme(style="whitegrid")
ax = sns.lineplot(x=data["a"], y=data["b"], marker="o")
ax.set(title="Figure Title")
plt.show()